<!--
 * @Author: ssj
 * @Date: 2021-06-26 17:51:15
 * @LastEditors: ssj
 * @LastEditTime: 2021-10-15 18:47:44
 * @Description: id组件
-->

<template>
  <div class="o-id-render">
    <span>{{ value }}</span>
  </div>
</template>

<script lang="ts">
import { Component, Vue, Prop, Watch } from 'vue-property-decorator';
import { Tsrv } from '@/services';

@Component
export default class oIdRender extends Vue {
  /**
   * props
   */
  @Prop() params: any;

  public compName: string = 'oIdRender';

  private value = null;

  /**
   * data
   */
  @Watch('params')
  onParamsChange() {
    this.setValue();
  }

  mounted() {
    this.setValue();
  }

  setValue() {
    if (this.params.property) {
      this.value = this.params.data[this.params.property];
    } else {
      this.value = this.params.row[this.params.column.property];
    }
  }
}
</script>
